/*
 * Created on Jan 20, 2006
 */
package com.payroll.framework;

/**
 * Description: Limited exception chaining provides a common exception interface
 *
 * Created: Jan 20, 2006 11:57:50 AM
 * @author Ray James (RSJ)
 */
public class PayrollException extends Exception {
	private Throwable cause = null;

	public PayrollException() { super(); }

	public PayrollException(String message) { super(message); }

	public PayrollException(Throwable cause){
		super();
		this.cause = cause;
	}

	public PayrollException(String message, Throwable cause) {
		super(message);
		this.cause = cause;
	}

	public Throwable getCause() { return cause; }

	public void printStackTrace() {
		super.printStackTrace();
		if (cause != null) {
			System.out.println("Caused by:");
			cause.printStackTrace();
		}
	}

	public void printStackTrace(java.io.PrintStream ps){
		super.printStackTrace(ps);
		if (cause != null) {
			ps.println("Caused by:");
			cause.printStackTrace(ps);
		}
	}

	public void printStackTrace(java.io.PrintWriter pw){
		super.printStackTrace(pw);
		if (cause != null) {
			pw.println("Caused by:");
			cause.printStackTrace(pw);
		}
	}
}
